from django.contrib import admin

from contract.model.parter import Partner
from contract.model.post import Post


# Register your models here.
class Postadmin(admin.ModelAdmin):
    list_display = ('title','begindate','enddate','cost','partner_name','contract_holder')
    list_filter = ('title',)
    search_fields = ('title',)
    def save_model(self, request, obj, form, change):
        obj.operater = request.user
        obj.save()
    
    def get_readonly_fields(self, request, obj=None):
        return self.readonly_fields + ('operater',)

class Partneradmin(admin.ModelAdmin):
    list_display = ('username','telephonenum','company')

admin.site.register(Post,Postadmin) 
admin.site.register(Partner,Partneradmin)
